Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ln/max tip age bug fix #1392

Merged
merged 33 commits into from
Jul 25, 2024
Merged

Ln/max tip age bug fix #1392

merged 33 commits into from
Jul 25, 2024

Conversation

lazynina
Copy link
Member

No description provided.

cmd/node.go Show resolved Hide resolved
@@ -680,6 +681,16 @@ func (fe *fastHotStuffEventLoop) tryConstructVoteQCInCurrentView() *FastHotStuff
// Fetch the validator list at the tip.
validatorList := fe.tip.validatorList

for _, validator := range validatorList {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote a function called DomainsToString(). Let's use that here and elsewhere instead of iterating over GetDomains().

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, you can actually use validator.GetDomainsString(). The DomainsToString() function is useful if you don't have access to the validator object, which happens in some cases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we don't have the ValidatorEntry, we only have the Validator interface, so I'll use DomainsToString()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also renaming to validatorItem so it doesn't overlap w/ the type of name validator that we use in the consensus package.

@@ -757,6 +772,24 @@ func (fe *fastHotStuffEventLoop) tryConstructTimeoutQCInCurrentView() *FastHotSt
// to aggregate timeouts from the previous one.
timeoutsByValidator := fe.timeoutsSeenByView[fe.currentView-1]

glog.V(2).Infof("FastHotStuffEventLoop.tryConstructTimeoutQCInCurrentView: "+
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This spew isn't useful but the thing below it is. So delete the spew but keep the thing below it. And just swap out DomainsToString to save some redundancy.

if bc.checkpointBlockInfo != nil {
highestView = bc.checkpointBlockInfo.LatestView
}
bc.checkpointBlockInfoLock.RUnlock()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine to keep for now. I have a slight worry that we will get into a scenario where we want to IGNORE the checkpoint validator, but we can fix that in some other way if we ever hit that problem.

But also I would rewrite this using defer in its own function to avoid the manual RLock()/RUnlock() pattern.

func (bc *Blockchain) GetHighestView() uint64 {
  bc.checkpointBlockInfoLock.RLock()
  defer bc.checkpointBlockInfoLock.RUnlock()

  if bc.checkpointBlockInfo != nil { return bc.checkpointBlockInfo.LatestView }
  return 0
}

lib/connection_manager.go Show resolved Hide resolved
lib/network_manager.go Show resolved Hide resolved
lib/server.go Show resolved Hide resolved
glog.Error(err)
return nil, err
}
if chainState != SyncStateFullyCurrent && !srv.blockchain.params.IsPoSBlockHeight(tipHeight) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we change this to fix the SYNCING_HEADERS error on Diamond? I think it's fine to keep regardless just wondering.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - this was the fix to allow us to allow transaction relay regardless of sync status.

@@ -2856,6 +2880,9 @@ func (srv *Server) _handleFastHotStuffConsensusEvent(event *consensus.FastHotStu
}

func (srv *Server) _handleValidatorVote(pp *Peer, msg *MsgDeSoValidatorVote) {
if msg.GetMsgType() != MsgTypeValidatorVote {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these are good to have for defensiveness so I'd leave them.

// Viper doesn't work when you have environment variables. This is the
// suggested workaround:
// https://github.com/spf13/viper/issues/380
func GetStringSliceWorkaround(flagName string) []string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I applied this thing pretty quickly, but I think we need to keep it generally so I'd leave it. If you don't have it then it literally can't process comma-separated values when you pass them as env vars.

@lazynina lazynina marked this pull request as ready for review July 25, 2024 01:28
@lazynina lazynina requested a review from a team as a code owner July 25, 2024 01:28
@@ -190,8 +190,10 @@ func (nm *NetworkManager) startValidatorConnector() {
nm.exitGroup.Done()
return
case <-time.After(nm.peerConnectionRefreshInterval):
glog.V(2).Infof("NetworkManager.startValidatorConnector: Refreshing validator indices...")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I should have been more clear. Let's also delete these glogs because they're too verbose. They just print every second.

@@ -404,6 +410,11 @@ func (nm *NetworkManager) processOutboundConnection(conn Connection) (*RemoteNod
return nil, fmt.Errorf("NetworkManager.handleOutboundConnection: Connection is not an outboundConnection")
}

if !addrmgr.IsRoutable(oc.address) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we were going to delete this. Wasn't it commented out in the last revision? If we have it it could mess up nodes running within datacenters.

@@ -209,9 +209,11 @@ func (nm *NetworkManager) startNonValidatorConnector() {
nm.exitGroup.Done()
return
case <-time.After(nm.peerConnectionRefreshInterval):
glog.V(2).Infof("NetworkManager.startNonValidatorConnector: Refreshing NON validator indices...")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry delete this and the one below it as well. Don't want to have any logging in this select.

@lazynina lazynina merged commit 57373bf into main Jul 25, 2024
2 of 3 checks passed
@lazynina lazynina deleted the ln/max-tip-age-bug-fix branch July 25, 2024 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants